package com.monicaca.service;

import com.monicaca.bean.INV;
import com.monicaca.dao.INVDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class INVService {
	@Autowired
	private INVDAO INVDAO;
	
	public INV findByInvId(int INVId) {  
        return INVDAO.findById(INV.class, INVId);  
    }  
	/*public RKD findByRKDName(RKD RKD) {
        return RKDDAO.findByName(RKD);
    }*/


    public List<INV> findAll() {  
        return INVDAO.findAll(INV.class);  
    }
    @Transactional
    public int count3() {
        return INVDAO.count3();
    }

    @Transactional  
    public void createINV(INV INV) {  
    	INVDAO.save(INV);  
    }  
  
    @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW )

    public void updateINV(INV INV) {  
    	INVDAO.update(INV);  
    }  
  
    @Transactional  
    public void deleteINV(int INVId) {  
    	INVDAO.deleteById(INV.class, INVId);  
    }  
  
    @Transactional  
    public void deleteINV(INV INV) {  
    	INVDAO.delete(INV);  
    }  
}
